#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>
int f(int x, int y)
{
    int ret = x;
    if (y == 0)
    {
        ret = 1;
    }
    for (int i = 2; i <= y; i++)
    {
        ret *= x;
    }
    return ret;
}

int main()
{
    int m, i, j, i1, y;
    int n;
    scanf("%d", &n);
    int a[n];
    m = n - 1;
    i = f(10, m);
    j = f(10, n);
    while (i < j)
    {
        i1 = i;
        int num, sum = 0;
        for (num = 0; num < n; num++)
        {
            y = f(10, m);
            a[num] = i1 / y;
            i1 = i1 - a[num] * y;
            m--;
        }
        for (num = 0; num < n; num++)
        {
            sum += f(a[num], n);
        }
        if (sum == i)
        {
            printf("%d\n", i);
        }
        m = n - 1;
        i++;
    }
    return 0;
}